/**
 * File TestMsgToSendModel.java 
 */
package cstest.model;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import cs.entity.UserTextMessage;
import cs.model.MsgToSendModel;

/**
 * Package  cstest.model
 * Project ChatSystemG1 - INSA 4INFOA1 - 2013/2014
 * @author Julie DUMONS & Juste OUEDRAOGO
 *
 */
public class TestMsgToSendModel {
	MsgToSendModel mtsm1, mtsm2 ; 
	UserTextMessage um1, um2 ; 

	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		um1 = new UserTextMessage(null, null) ; 
		mtsm2 = new MsgToSendModel();
	}

	/**
	 * @throws java.lang.Exception
	 */
	@After
	public void tearDown() throws Exception {
		um1 = null ;
	}
	

	/**
	 * Test method for {@link cs.model.MsgToSendModel#MsgToSendModel()}.
	 */
	@Test
	public void testMsgToSendModel() {
		assertNull(mtsm1); 
		mtsm1 = new MsgToSendModel() ; 
		assertNotNull(mtsm1); 
		
	}

	/**
	 * Test method for {@link cs.model.MsgToSendModel#addMsgToSend(cs.entity.UserTextMessage)}.
	 */
	@Test
	public void testAddMsgToSend() {
		assertNull(mtsm2.getRemoveMsgToSend()); 
		mtsm2.addMsgToSend(um1)	;	
		assertSame(um1,mtsm2.getRemoveMsgToSend());
	}

	/**
	 * Test method for {@link cs.model.MsgToSendModel#getRemoveMsgToSend()}.
	 */
	@Test
	public void testGetRemoveMsgToSend() {
		assertNull(mtsm2.getRemoveMsgToSend()); 
		mtsm2.addMsgToSend(um1)	;	
		mtsm2.addMsgToSend(um2)	;	
		assertSame(um1,mtsm2.getRemoveMsgToSend());
		assertSame(um2,mtsm2.getRemoveMsgToSend());
		assertNull(mtsm2.getRemoveMsgToSend()); 
		
	}

	/**
	 * Test method for {@link cs.model.MsgToSendModel#removeAllMsgToSend()}.
	 */
	@Test
	public void testRemoveAllMsgToSend() {
		mtsm2.addMsgToSend(um1)	;	
		mtsm2.addMsgToSend(um2)	;	
		mtsm2.removeAllMsgToSend();
		assertNull(mtsm2.getRemoveMsgToSend()); 

		
	}

}
